import pygame
import sys
import time
import random

#Iniciar pygame
pygame.init()

#Defino los colores
BLANCO = (255,255,255)
AZUL = (0, 0, 255)
NEGRO = (0,0,0)
ROJO = (255,0,0)

# Configurar la ventana
ancho = 800
alto = 400
ventana = pygame.display.set_mode((ancho, alto))
#Poner el nombre de la ventana.
pygame.display.set_caption("Call of Duty")
#Defino a la imagen de fondo
fondo = pygame.image.load("img/fondo.png")
x,y = 0,0
ventana.blit(fondo, [x,y])
pygame.display.flip()
#Defino a Fang quieto.
fang = pygame.image.load("img/fang1.png")
x2,y2 = 50,50
ventana.blit(fang, [x2,y2])
pygame.display.flip()
#Defino a Fang andando.
fangw1 = pygame.image.load("img/fang2.png")
fangw2 = pygame.image.load("img/fang3.png")
fangw3 = pygame.image.load("img/fang4.png")
fangw4 = pygame.image.load("img/fang5.png")
fangw5 = pygame.image.load("img/fang6.png")
fangw6 = pygame.image.load("img/fang7.png")
fangw = (fang, fangw1, fangw2, fangw3, fangw4, fangw5, fangw6, fang)
#Bucle de eventos
while True:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			pygame.quit()
			sys.exit()
		if event.type == pygame.KEYDOWN:
			if event.key == pygame.K_RIGHT:
				ventana.blit(fondo, [x,y])
				ventana.blit(fangw1, [x2,y2])
				pygame.display.flip()
				time.sleep(0.15)
				x2 = x2 + 10
				ventana.blit(fondo, [x,y])
				ventana.blit(fangw2, [x2,y2])
				pygame.display.flip()
				time.sleep(0.15)
				x2 = x2 + 10
				ventana.blit(fondo, [x,y])
				ventana.blit(fangw3, [x2,y2])
				pygame.display.flip()
				time.sleep(0.15)
				x2 = x2 + 10
				ventana.blit(fondo, [x,y])
				ventana.blit(fangw4, [x2,y2])
				pygame.display.flip()
				time.sleep(0.15)
				x2 = x2 + 10
				ventana.blit(fondo, [x,y])
				ventana.blit(fangw5, [x2,y2])
				pygame.display.flip()
				time.sleep(0.15)
				x2 = x2 + 10
				ventana.blit(fondo, [x,y])
				ventana.blit(fangw6, [x2,y2])
				pygame.display.flip()
				time.sleep(0.15)
				x2 = x2 + 10
				ventana.blit(fondo, [x,y])
				ventana.blit(fang, [x2,y2])
				pygame.display.flip()
				x2 = x2 + 10
					
